package com.yt.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.UUID;

@RestController
public class SessionController {
    @RequestMapping("/set")
    public String set(HttpSession session){
        String id= UUID.randomUUID().toString();
        session.setAttribute("id",id);
        return "写入"+id;
    }

    @RequestMapping("/get")
    public String get(HttpSession session){

        String id=(String)session.getAttribute("id");
        return "读取"+id;
    }


}
